package cn.ly.net.udp;


import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class ReceiveDemo1 {
	
	public static void main(String[] args) throws Exception {
		DatagramSocket ds = new DatagramSocket(10010);
		
		while(true){

			//开多线程，处理dp数据，
			Thread t = new Thread();
			t.start();
			
			byte[] bys = new byte[1024];
			DatagramPacket dp = new DatagramPacket(bys,bys.length);
			ds.receive(dp);
			String ip = dp.getAddress().getHostAddress();
			String content = new String(dp.getData());
			System.out.println(ip + " : " + content);
		}
		
	}
	

}
